class MerchantUser {
  final String? id; // _id 转换为 id
  final String unionId; // union_id
  final String name;
  final int status;
  final String? owner;
  final String? role;
  final int? createdAt;
  final String? createBy;
  final String? updateBy;
  final int? updatedAt;

  MerchantUser({
    this.id,
    required this.unionId,
    required this.name,
    required this.status,
    this.owner,
    this.role,
    this.createdAt,
    this.createBy,
    this.updateBy,
    this.updatedAt,
  });

  factory MerchantUser.fromJson(Map<String, dynamic> json) {
    return MerchantUser(
      id: json['id'] as String?, // _id 转换为 id
      unionId: json['union_id'] as String? ?? '',
      name: json['name'] as String? ?? '',
      status: json['status'] as int? ?? 0,
      owner: json['owner'] as String?,
      role: json['role'] as String?,
      createdAt: json['createdAt'] as int?,
      createBy: json['createBy'] as String?,
      updateBy: json['updateBy'] as String?,
      updatedAt: json['updatedAt'] as int?,
    );
  }
}
